package com.esp.studentManagementSystem.pojo.bo;


import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserBO implements UserDetails, Serializable {
    private Integer userId;
    private String username;
    private String password;
    private String sex;
    private String address;
    private Boolean enabled;
    private Boolean accountNoExpired;
    private Boolean credentialsNoExpired;
    private Boolean accountNoLocked;
    private List<? extends GrantedAuthority> authorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public boolean isAccountNonExpired() {
        return getAccountNoExpired();
    }

    @Override
    public boolean isAccountNonLocked() {
        return getAccountNoLocked();
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return getCredentialsNoExpired();
    }

    @Override
    public boolean isEnabled() {
        return getEnabled();
    }

}
